/*
 * libbeluga
 *
 * libbeluga is the property of its developers.  See the COPYRIGHT file
 * for more details.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef BELUGA_POD_H
#define BELUGA_POD_H

#include "libbeluga.h"

struct _BelugaPod {
  PurpleConversation *conv;

  gchar *id;
  gchar *title;
  gchar *ihash;
  gchar *imageUrl;

  // gint64 time;
  // gchar *location;
  //GHashTable *members;
  GHashTable *updates;
  GSList *toSend;

  gint   lastUpdateReceived;
  gint   nextUpdateDisplayed;

  guint retryPollPodTimeout;
  guint catchupPodTimeout;
  gchar *photosPath;
};

BelugaPod *
BelugaPodNew();

void
BelugaPodFree(BelugaPod *pod);

BelugaPod *
BelugaPodFromHtml(const gchar *html, const gchar **htmlEnd);

BelugaPod *
BelugaPodFromJson(const gchar *json, const gchar **jsonEnd);

//BelugaPod *
//BelugaPodMembersFromHtml(gchar *html);

void
BelugaPodSetTitle(BelugaPod *pod,
		  gchar *newTitle);

void
BelugaPodSetIHash(BelugaPod *pod,
		  gchar *newIHash);

gboolean
BelugaPodHasUpdate(BelugaPod *pod, 
		   gint index);

BelugaUpdate *
BelugaPodGetUpdate(BelugaPod *pod, 
		   gint index);

void
BelugaPodAddUpdate(BelugaPod *pod, 
		   BelugaUpdate *update);

void 
BelugaPodImageFromPngData(BelugaAccount *account,
			  BelugaPod *pod,
			  gchar *data, gsize dataLen);

void
BelugaPodGeneratePhotoPath(BelugaAccount *account,
			   BelugaPod *pod);

#endif /* BELUGA_UPDATE_H */
